package com.vpx.server.controller.system;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;

import com.vpx.server.bean.entity.CTypeRel;
import com.vpx.server.framework.base.ResultMsg;
import com.vpx.server.service.system.CTypeRelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/api/cTypeRel")
@Api(tags ="测试用例与分类")
public class CTypeRelController  {
    @Autowired
    private CTypeRelService service;
    @ApiOperation("添加")
    @PostMapping("/insert")
    public ResultMsg insert(CTypeRel c){
        c.setId(IdUtil.simpleUUID());
        Date date = DateUtil.date(System.currentTimeMillis());
        c.setCreateTime(date.toString());
        service.insert(c);
        return ResultMsg.success("");
    }
    @ApiOperation("删除")
    @GetMapping("/delete")
    public ResultMsg delete(CTypeRel  c){
        service.delete(c);
        return ResultMsg.success("");
    }
    @ApiOperation("修改")
    @PostMapping("/update")
    public ResultMsg update(CTypeRel  c){
        service.update(c);
        return ResultMsg.success("");
    }
    @ApiOperation("查询")
    @GetMapping("/selectAll")
    public ResultMsg selectAll(){
        List<CTypeRel> list=
                service.selectAll();
        return ResultMsg.success(list);
    }


}
